<?php

	if(!array_key_exists("message_id", $_POST)){
		header("Location: index.php");
	}
	
	session_start();
	//User has credentials to validate
	$conn = mysql_connect("", "piedu_user", "q&&^%@8ezO8+");
	mysql_select_db("piedu_db");
	$sql = "INSERT INTO community_reply (id, username, message) values ('{$_POST['message_id']}', '{$_SESSION['username']}', '{$_POST['message']}')";
	mysql_query($sql, $conn);
	header("Location: main.php?username={$_SESSION['username']}");
	exit;
?>